﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;

namespace MyDemos.Demos
{
    public partial class FontSizeDemo : PhoneApplicationPage
    {
        public FontSizeDemo ()
        {
            InitializeComponent ();
        }

        private void PhoneApplicationPage_Loaded (object sender, RoutedEventArgs e)
        {

            double before = cTextBlock.ActualHeight;

            while (cTextBlock.ActualWidth > 450)
            {
                cTextBlock.FontSize--;
            }

            double after = cTextBlock.ActualHeight;

            ScaleTransform a = new ScaleTransform();
            a.ScaleY = before / after;

            cTextBlock.RenderTransform = a;


            while (cTextBlock2.ActualWidth > 350)
            {
                cTextBlock2.FontSize--;
            }
            while (cTextBlock3.ActualWidth > 250)
            {
                cTextBlock3.FontSize--;
            }

            before = cTextBlock4.ActualHeight;

            while (cTextBlock4.ActualWidth > 150)
            {
                cTextBlock4.FontSize--;
            }

            after = cTextBlock4.ActualHeight;

            a.ScaleY = before / after;

            cTextBlock4.RenderTransform = a;

        }

        private void button1_Click (object sender, RoutedEventArgs e)
        {

        }


    }
}